<template>
	<view>
		<view class="con">
			<view class="item">
				<view class="title">
					赠送数量<text style="color: #FF4E31;">*</text>
				</view>
				<u--input
				    placeholder="请输入赠送数量"
				    border="surround"
				    v-model="form.score"
					type='number'
				  ></u--input>
			</view>
			<view class="item">
				<view class="title">
					对方ID<text style="color: #FF4E31;">*</text>
				</view>
				<u--input
				    placeholder="请输入对方ID"
				    border="surround"
				    v-model="form.targetId"
				  ></u--input>
			</view>
		</view>
		<view class="footer">
			<view class="btn" @click="submit">
				确认转赠
			</view>
		</view>
	</view>
</template>

<script>
	import {exchangscore} from '@/api/my.js'
	export default {
		data() {
			return {
				form:{
					targetId:'',
					score:''
				}
			};
		},
		methods:{
			submit(){
				let {targetId,score}=this.form
				if(!score){
					uni.showToast({
						title:'请输入赠送数量',
						icon:'none'
					})
					return
				}
				if(!targetId){
					uni.showToast({
						title:'请输入对方ID',
						icon:'none'
					})
					return
				}
				exchangscore(this.form).then(res=>{
					// console.log(res)
					if(res.data.code==1){
						uni.showToast({
							title:res.data.msg,
							icon:'none'
						})
					}
				})
			}
		},
		onLoad(option) {
			if(option){
				this.form.targetId=option.id
			}
		}
	}
</script>

<style lang="less">
.con{
	padding: 0 28rpx;
	border-top: 2rpx solid #F4F6F8;
	.item{
		margin-top: 38rpx;
	}
	.title{
		font-size: 30rpx;
		color: #333333;
	}
	.u-input{
		background-color: #F7F6F6;
		margin-top: 28rpx;
	}
	.u-border{
		border-color:#F7F6F6!important;
	}
	.u-input--radius{
		border-radius: 20rpx;
	}
}
.footer{
	width: 750rpx;
	display: flex;
	justify-content: center;
	position: fixed;
	bottom: 93rpx;
	right: 0;
	.btn{
		width: 687rpx;
		line-height: 114rpx;
		background: linear-gradient(153deg, #FF8717, #FF5F00);
		border-radius: 57rpx;
		text-align: center;
		color: #fff;
		font-size: 36rpx;
	}
}
</style>
